package com.db;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.entity.User;

public class UserDao extends BaseDao<User>{

	public List<User> queryalluser(){
		String sql="select * from user";
		return super.queryall(sql);
	}
	public User queryUser(int id) {
		String sql="select * from user where id='"+id+"'";
		return super.query(sql);
	}
	@Override
	protected User getEntity(ResultSet rs) {
		
		User user =new User();
		try {
			user.setId(rs.getInt("id"));
			user.setName(rs.getString("uname"));
			user.setPassword(rs.getString("upwd"));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return user;
	}

}
